Skip to content

Comm Component for Simplex #3998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jul 15, 2025
Merged

Comm Component for Simplex #3998

merged 42 commits into from
Jul 15, 2025

Conversation

samliok
Copy link
Contributor

@samliok samliok commented Jun 5, 2025

Why this should be merged

The Comm interface is used by simplex to send and broadcast messages. This PR builds off pr #3993 and should be merged after

How this works

This PR adds two new fields to the Config struct—Sender and OutboundMsgBuilder—which enable the Simplex engine to construct and send outbound messages to other nodes.

How this was tested

Using generated mocks for ExternalSender and OutboundMessageBuilder, I added tests in comm_test to verify that the correct messages are sent the expected number of times.

Need to be documented in RELEASES.md?

No

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 21:33
@samliok samliok requested a review from StephenButtolph as a code owner June 5, 2025 21:33
@samliok samliok marked this pull request as draft June 5, 2025 21:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the communication component for Simplex by adding new fields to the Config struct and implementing a Comm type for sending and broadcasting messages among validators. Key changes include:

  • Adding new Config fields (Sender and OutboundMsgBuilder) to support message construction and delivery.
  • Implementing Comm with methods for SendMessage and Broadcast.
  • Updating tests and mocks to validate the communication flow and BLS signing functionality.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
simplex/test_utils.go Added test utilities for validator info and engine config
simplex/config.go Extended Config struct to include Sender and MsgBuilder
simplex/comm_test.go Added tests for Comm functionality and error conditions
simplex/comm.go Implemented Comm with SendMessage and Broadcast methods
simplex/bls_test.go, simplex/bls.go Added BLS authentication with signing and verification
message/simplex_outbound_msg_builder.go Added Simplex-specific outbound message builder functions
message/outbound_msg_builder.go Integrated Simplex builder into general outbound messaging
message/messagemock/outbound_message_builder.go Updated mocks with Simplex message methods
go.mod Updated dependency for simplex package

@samliok samliok self-assigned this Jun 6, 2025
@samliok samliok changed the base branch from master to simplex-bls June 9, 2025 16:56
@samliok samliok marked this pull request as ready for review June 9, 2025 18:40
@samliok samliok requested a review from maru-ava as a code owner June 12, 2025 19:24
samliok and others added 3 commits June 12, 2025 12:25
Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>
@@ -181,6 +181,8 @@ type OutboundMsgBuilder interface {
chainID ids.ID,
msg []byte,
) (OutboundMessage, error)

SimplexOutboundMessageBuilder
}

type outMsgBuilder struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can utilize this in tests by using message.NewCreator.

simplex/comm.go Outdated
Comment on lines 35 to 36
// nodes are the IDs of all the nodes in the subnet
nodes []simplex.NodeID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we stored a copy of these as a set.Set[ids.ID] (without our own nodeID) then we wouldn't need to construct that set on every call to Broadcast.

Copy link
Contributor Author

@samliok samliok Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this would make things awkward with comm.Nodes() since it expects []simplex.NodeID and also expects the current nodeID to be included.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting to store both on the struct

samliok and others added 5 commits July 15, 2025 15:00
@StephenButtolph StephenButtolph added this pull request to the merge queue Jul 15, 2025
Merged via the queue into master with commit 1764c72 Jul 15, 2025
29 checks passed
@StephenButtolph StephenButtolph deleted the simplex-comm branch July 15, 2025 21:23
@github-project-automation github-project-automation bot moved this from In Progress 🏗️ to Done 🎉 in avalanchego Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants